﻿@model  YodaMaster.Models.BrowsePostViewModel


@{
    ViewBag.Title = "Courses";
}

<p></p>
<p></p>
@using (Html.BeginForm())
{
 <p>
      @Html.Label("Courses from " + Model.SelectedFaculty + ":")
 
      @Html.DropDownListFor(m=>m.SelectedCourse, Model.Course)

        <input type="submit" value="Next" />
    

 </p>
 
    }

@using (Html.BeginForm("Index2", "Courses", FormMethod.Get) )
{
    
        
        <input type="hidden" name="selected" value = @Model.SelectedFaculty />
       <div style="white-space: nowrap"> Find by name: @Html.TextBox("searchString")  
        <input type="submit" value="Search" /> </div>
}

@using (Html.BeginForm("Index2", "Courses", FormMethod.Get))
{
    
        <input type="hidden" name="selected" value = @Model.SelectedFaculty />
       <div style="white-space: nowrap"> Find by id: @Html.TextBox("search_id")  
        <input type="submit" value="Search" /> </div>
}

<p></p>
<p></p>
<p></p>
<table border="1">
  <tr>
    <th></th>
    <th></th>
    <th>
        @Html.ActionLink("Name", "Index2", new { sortOrder=ViewBag.NameSortParm, selected  = Model.SelectedFaculty })
    </th>
    <th>
        @Html.ActionLink("ID", "Index2", new {  sortOrder=ViewBag.IDSortParm, selected  = Model.SelectedFaculty })
    </th>
</tr>

@foreach (var item in Model.courses) {
    <tr>
        <td>
            @Html.ActionLink("Details", "Details", new { selected_c = item, selected_f = Model.SelectedFaculty })
        </td>
        <td>
            @Html.ActionLink("Add to Cart", "../ScheduleCart/AddToCart", new { id = item.Split(':')[1].Split(' ')[1] })
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Split(':')[0])
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Split(':')[1])
        </td>
       
    </tr>
}

</table>
